package com.djp.smartapp.util;

import android.content.Context;
import android.content.SharedPreferences;


public class LineSpUtil {
    private static final String TAG = "LineSpUtil";
    private  static SharedPreferences sharedPreferences;

    public static void setLine(int userId, int id,Context context){
        if(sharedPreferences == null)
            sharedPreferences = context.getSharedPreferences("line", Context.MODE_PRIVATE);

        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.clear();
        edit.putInt("userId", userId);
        edit.putInt("lineId", id);
        edit.commit();
    }

    public static int getUserLineId(Context context) {
        if(sharedPreferences == null)
            sharedPreferences = context.getSharedPreferences("line", Context.MODE_PRIVATE);

        return sharedPreferences.getInt("userId", -1);
    }

    public static int getLineId(Context context) {
        if(sharedPreferences == null)
            sharedPreferences = context.getSharedPreferences("line", Context.MODE_PRIVATE);

        return sharedPreferences.getInt("lineId",-1);
    }
}
